<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<div class="aui-fullpage security-policy-page">
    <div class="aui-header-1">
        <lv-group lvGutter='8px'>
            <h1>{{ 'system_data_security_label' | i18n }}</h1>
            <aui-multi-cluster-switch (onChange)="onChange()"></aui-multi-cluster-switch>
        </lv-group>
    </div>
    <div class="aui-block  aui-gutter-column-md security-policy-container">
        <div class="aui-header-2">
            <h2>{{ 'system_encryption_setting_label' | i18n }}</h2>
            <div pmpermission pmOperation='ModifyDataSecurity'>
                <lv-group lvGutter='10px' *ngIf="!viewSettingFlag">
                    <span class="aui-link" (click)="saveEncryptionPolicy()">
                        {{ 'common_save_label' | i18n }}
                    </span>
                    <span class="aui-link" (click)="cancelEncryptionPolicy()">
                        {{ 'common_cancel_label' | i18n }}
                    </span>
                </lv-group>
                <span *ngIf="viewSettingFlag" class="aui-link" (click)="modifyEncryptionPolicy()">
                    {{ 'common_modify_label' | i18n }}
                </span>
            </div>
        </div>
        <div class="dashed-line"></div>
        <div *ngIf="viewSettingFlag">
            <lv-form>
                <ng-container *ngIf="!isX3000">
                    <lv-form-item>
                        <lv-form-label>
                            {{ 'system_replication_encryption_label' | i18n }}
                            <i lv-icon="aui-icon-help"
                                lv-tooltip="{{ 'system_replication_encryption_tips_label' | i18n }}"
                                lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
                        </lv-form-label>
                        <lv-form-control>
                            {{replicationLinkEncryption | textMap: 'Switch_Status'}}
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <lv-form-item>
                    <lv-form-label>
                        {{ 'system_backup_encryption_label' | i18n }}
                        <i lv-icon="aui-icon-help" lv-tooltip="{{ 'system_encryption_setting_tips_label' | i18n }}"
                            lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
                    </lv-form-label>
                    <lv-form-control>
                        {{backupLinkEncryption | textMap: 'Switch_Status'}}
                    </lv-form-control>
                </lv-form-item>
            </lv-form>
        </div>
        <div *ngIf="!viewSettingFlag">
            <lv-form [formGroup]="formGroup">
                <ng-container *ngIf="!isX3000 && !appUtilsService.isDistributed">
                    <lv-form-item>
                        <lv-form-label>
                            {{ 'system_replication_encryption_label' | i18n }}
                            <i lv-icon="aui-icon-help"
                                lv-tooltip="{{ 'system_replication_encryption_tips_label' | i18n }}"
                                lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
                        </lv-form-label>
                        <lv-form-control>
                            <lv-switch formControlName="replicationLinkEncryption">
                            </lv-switch>
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
                <lv-form-item>
                    <lv-form-label>
                        {{ 'system_backup_encryption_label' | i18n }}
                        <i lv-icon="aui-icon-help" lv-tooltip="{{ 'system_encryption_setting_tips_label' | i18n }}"
                            lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
                    </lv-form-label>
                    <lv-form-control>
                        <lv-switch formControlName="backupLinkEncryption">
                        </lv-switch>
                        <div *ngIf="formGroup.value.backupLinkEncryption">
                            <i lv-icon="lv-icon-status-info" lvColorState='true'></i>
                            <span innerHTML="{{'system_enable_backup_encryption_label' | i18n}}" class="mgl"></span>
                        </div>
                    </lv-form-control>
                </lv-form-item>
            </lv-form>
        </div>
    </div>
    <div class="aui-block  aui-gutter-column-md security-policy-container"
         *ngIf="!appUtilsService.isDistributed && !isDecouple">
        <div class="aui-header-2">
            <h2>{{ 'system_data_verify_label' | i18n }}</h2>
            <div pmpermission pmOperation='ModifyDataSecurity'>
                <lv-group lvGutter='10px' *ngIf="!viewVerifySettingFlag">
                    <span class="aui-link" (click)="saveEncryptionPolicy()">
                        {{ 'common_save_label' | i18n }}
                    </span>
                    <span class="aui-link" (click)="cancelVerifyPolicy()">
                        {{ 'common_cancel_label' | i18n }}
                    </span>
                </lv-group>
                <span *ngIf="viewVerifySettingFlag" class="aui-link" (click)="modifyVerifyPolicy()">
                    {{ 'common_modify_label' | i18n }}
                </span>
            </div>
        </div>
        <div class="dashed-line"></div>
        <div *ngIf="viewVerifySettingFlag">
            <lv-form>
                <lv-form-item>
                    <lv-form-label>
                        {{ 'system_protect_object_file_system_verify_label' | i18n }}
                        <i lv-icon="aui-icon-help" lv-tooltip="{{ 'system_data_verify_tips_label' | i18n }}"
                            lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
                    </lv-form-label>
                    <lv-form-control>
                        {{protectObjectFileSystemvVerify | textMap: 'Switch_Status'}}
                    </lv-form-control>
                </lv-form-item>
            </lv-form>
        </div>
        <div *ngIf="!viewVerifySettingFlag">
            <lv-form [formGroup]="verifyFormGroup">
                <lv-form-item>
                    <lv-form-label>
                        {{ 'system_protect_object_file_system_verify_label' | i18n }}
                        <i lv-icon="aui-icon-help" lv-tooltip="{{ 'system_data_verify_tips_label' | i18n }}"
                            lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
                    </lv-form-label>
                    <lv-form-control>
                        <lv-switch formControlName="protectObjectFileSystemvVerify">
                        </lv-switch>
                    </lv-form-control>
                </lv-form-item>
            </lv-form>
        </div>
    </div>
</div>
